//
//  ECDefine.h
//  JuJuSports
//
//  Created by Jame on 15/5/14.
//  Copyright (c) 2015年 SSIC. All rights reserved.
//

#ifndef JuJuSports_ECDefine_h
#define JuJuSports_ECDefine_h


//Category
#import "ECURLPath.h"
#import "ECCustom.h"
#import "ECHelper.h"
#import "UIView+Frame.h"
#import "NSDate+Utils.h"
#import "NSString+Handle.h"
#import "UIImage+Resize.h"
#import "UserInfoManager.h"

//Network
#import "ECHttpManager.h"
#import "AFNetworking.h"
#import "Reachability.h"
#import "UIImageView+WebCache.h"
#import "UIImageView+AFNetworking.h"
#import "UIButton+AFNetworking.h"

//View
#import "ECBaseViewController.h"
#import "MBProgressHUD.h"
#import "Masonry.h"
#import "MJRefresh.h"
#import "XLCycleScrollView.h"
#import "VOSegmentedControl.h"
#import "CDPDatePicker.h"
#import "LMAlertView.h"
#import "CLWeeklyCalendarView.h"
#import "DOPDropDownMenu.h"

//Model
#import "MJExtension.h"


//手动内存管理
#define ECREMOVESUPERVIEW(x)    [x removeFromSuperview]; [x release]; x = nil
#define ECRELEASE(x)            [x release]; x = nil
#define ECRETAIN(x)             [x retain]

//屏幕尺寸
#define ECSCREEN          [[UIScreen mainScreen] bounds]
#define ECSCREEN_W        [[UIScreen mainScreen]bounds].size.width
#define ECSCREEN_H        [[UIScreen mainScreen]bounds].size.height

//系统控件高度
#define ECSTATUSBARHEIGHT       (20.0f)     //状态栏
#define ECTOPBARHEIGHT          (44.0f)     //顶部的高度
#define ECBOTTOMBARHEIGHT       (49.0f)     //底部的高度

//自定义控件大小
//图片
#define ECNavcLeftImageFrame CGRectMake(10, 28, 25, 25)
#define ECNavcRightImageFrame CGRectMake(ECSCREEN_W - 33, 28, 25, 25)
//按钮
#define ECNavcLeftButtonFrame CGRectMake(0, 0, 50, 64)
#define ECNavcRightButtonFrame CGRectMake(ECSCREEN_W - 50,0,50, 64)
//文字
#define ECNavcLeftLabelFrame CGRectMake(0, 22, 60, 34)
#define ECNavcRightLabelFrame CGRectMake(ECSCREEN_W - 60, 22, 60, 34)

//动态计算label高度
#define STRING_SIZE_FONT_HEIGHT(_width_, _string_, _fsize_) [_string_ boundingRectWithSize:CGSizeMake(_width_, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:_fsize_]} context:nil].size;

//设备判断
#define IS_IPHONE4  ([[UIScreen mainScreen] bounds].size.width == 320 &&  [[UIScreen mainScreen] bounds].size.height == 480)

#define IS_IPHONE5  ([[UIScreen mainScreen] bounds].size.width == 320 &&  [[UIScreen mainScreen] bounds].size.height == 568)

#define IS_IPHONE6  ([[UIScreen mainScreen] bounds].size.width == 375 &&  [[UIScreen mainScreen] bounds].size.height == 667)

#define IS_IPHONE6P  ([[UIScreen mainScreen] bounds].size.width == 414 &&  [[UIScreen mainScreen] bounds].size.height == 736)

//系统判断
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

//图片
#define ECIMAGENAME(_name_) [UIImage imageNamed:_name_]

//颜色
#define ECCOLOR(r, g, b, a)             [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]

#define ECCOLORFROMRGB(rgbValue)        [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]


#define NAVC_COLOR              ECCOLOR(212, 50, 47, 1)    //导航条颜色

#define BG_COLOR                ECCOLOR(239, 239, 239, 1) //背景颜色

#define FIRST_COLOR              ECCOLOR(255, 255, 255, 1)  //基本颜色

#define SECOND_COLOR            [UIColor orangeColor]//基本颜色

#define TABBAR_COLOR            ECCOLOR(212, 50, 47, 1) //TabBar颜色

//提示弹窗
#define SHOW_ALERT(_TITLE_,_MESSAGE_,_CANCELTEXT_,_OTHERTEXT_,_DELEGATE_) UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:_TITLE_ message:_MESSAGE_ delegate:_DELEGATE_ cancelButtonTitle:_CANCELTEXT_ otherButtonTitles:_OTHERTEXT_, nil];\
[alertView show];

//应用程序字体
#define SystemFont nil

//用户登录Key
#define USERKEY @"user_id_key"

#define MEMBERINFO @"memberInfo_key"

#define TEACHERINFO @"teacherInfo_key"

#define USER @"user_key"

#define PWD @"password_key"

#define AUTOLOGIN @"autoLogin_key"

#define LAT @"lat_key"

#define LNG @"lng_key"

// 用户权限
//#define USERULE @"USERULE"


//打印字符串结果
#define isDebug 1

//单例
#define SINGLETON(classname)                            \
+ (classname *)sharedInstance{                              \
static dispatch_once_t pred;                            \
__strong static classname *shared##classname=nil;       \
dispatch_once(&pred,^(void){                            \
shared##classname=[[self alloc]init];               \
});                                                     \
return shared##classname;                               \
}

#endif
